//
//  MyClassViewController.m
//  Learn
//
//  Created by zyl_macbookpro on 2024/4/10.
//  Copyright © 2024 迟建国. All rights reserved.
//

#import "MyClassViewController.h"

@interface MyClassViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic ,strong)UITableView *tableView;

@end

@implementation MyClassViewController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self renderNavBarWithBackgroundImage:[UIImage imageWithColor:lWhiteColor] backgroundColor:lClearColor shadowColor:nil textAttributeDic:@{NSForegroundColorAttributeName:rgba(51, 51, 51, 1),NSFontAttributeName:MFontWithSize(18)} enableScrollEdgeAppearance:NO];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"班级";
    // Do any additional setup after loading the view.
    [self setBackButtonIsHidden:NO];
    [self.view addSubview:self.tableView];
    self.view.backgroundColor = rgba(245, 245, 245, 1);
}
- (void)logoutBtnAction
{
    [lApp goLogin];
}
#pragma mark -UITableViewDelegate,UITableViewDelegate
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;
    
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        cell.selectionStyle =UITableViewCellSelectionStyleNone;
    }
    [cell removeAllSubviews];
    UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, lScreenWidth - 50, 22)];
    titleLabel.font = MFontWithSize(16);
    titleLabel.text = lApp.gradeName;
    [titleLabel setTextAlignment:NSTextAlignmentLeft];
    titleLabel.textColor = rgba(51, 51, 51, 1);
    
    UILabel * titleLabelSub = [[UILabel alloc] initWithFrame:CGRectMake(10, titleLabel.bottom + 10, lScreenWidth - 50, 20)];
    titleLabelSub.font = MFontWithSize(14);
    titleLabelSub.text = lApp.schoolName;
    ;
    [titleLabelSub setTextAlignment:NSTextAlignmentLeft];
    titleLabelSub.textColor = rgba(142, 142, 142, 1);
    
    UIImageView *image = [[UIImageView alloc] initWithImage:IMAGENAMED(@"ic_mine_arrow_black")];
    [image setFrame:CGRectMake(lScreenWidth - 18, 14, 8, 14)];
    [cell addSubview:titleLabel];
    [cell addSubview:titleLabelSub];
    [cell addSubview:image];
    return cell;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 79;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self pushToViewControllerWithClassName:@"ChangeClassViewController" animated:YES];
    
}
#pragma mark -getters and setters
-(UITableView *)tableView{
    if (!_tableView){
        _tableView =[[UITableView alloc] initWithFrame:CGRectMake(0, lTopBarHeight, lScreenWidth, lScreenHeight - lTopBarHeight) style:UITableViewStylePlain];
        [_tableView setDelegate:self];
        [_tableView setDataSource:self];
        _tableView.bounces = NO;
        [_tableView setBackgroundColor:lClearColor];
        [_tableView setSeparatorColor:rgba(229, 229, 229, 1)];
        [_tableView setSeparatorInset:UIEdgeInsetsMake(0, 10, 0, 0)];
    }
    
    return _tableView;
}


@end
